﻿var page = 1;
var plen = 20;
$(function () {
    load_data();
});
function htmls(d) {
    $('#datas').append('<section class="aui-card-content"><div class="aui-card-box"><div class="aui-card-box-user"><img src="' + d.mface + '"></div><div class="aui-card-box-name"><h2 class="aui-card-box-name">' + d.mname + '</h2><span class="aui-card-box-btn" style="border:none;color:#000;">' + (d.good == 1 ? '好评' : '差评') + '</span></div><div class="aui-card-box-time">' + d.time + '</div></div><div class="aui-card-media"><div class="aui-card-media-inner"><div class="aui-card-media-text"><p>' + d.content + '</p></div><div class="aui-card-media-describe" style="margin-top:5px;"><div class="aui-list-title-btn" style="text-align:left;"><span>' + (d.isreply == 1 ? ('回复：' + d.reply) : '') + '</span></div></div></div></div></section><div class="aui-dri"></div>');
}
function load_data() {
    $('#datas li').last().remove();
    $('#datas').append('<li style="padding:10px;text-align:center;">正在加载数据</li>');
    $.post('/dos_m/load_product_comment', { code: code, page: page, plen: plen }, function (d) { eval(d); });
}
function next() {
    page++;
    load_data();
}
function show(d, p) {
    $('#datas li').last().remove();
    if (d.length == 0) {
        $('#datas').append('<li style="padding:10px;text-align:center;">没有数据了</li>');
        return;
    }
    page = p;
    for (var i = 0; i < d.length; i++) {
        $('#datas').append(
                htmls(d[i])
            );
    }
    $('#datas').append('<li style="padding:10px;text-align:center;" onclick="next()">点此加载更多</li>');
}